package com.mushuilingfeng.ddd.user.domain.user.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author 沐水淋风
 * @date 2024/10/2
 */
@AllArgsConstructor
@Getter
public enum UserStatusEnum {
    OPEN(1, "启用"), STOP(-1, "停用"), LOCK(-2, "锁定");
    private final int code;
    private final String name;
    
    public static UserStatusEnum get(int code) {
        for (UserStatusEnum e : UserStatusEnum.values()) {
            if (e.code == code) {
                return e;
            }
        }
        return UserStatusEnum.LOCK;
    }
}
